Conversation
There was a problem hiding this comment.
Pull request overview
This pull request upgrades the Cashfree Payment Gateway Python SDK from version 4.5.1 to 5.0.1-beta, migrating from Pydantic v1 to Pydantic v2. This is a major breaking change that requires significant updates to all Pydantic model configurations throughout the codebase.
Changes:
- Upgraded pydantic dependency from
>= 1.10.24, < 2to>= 2.11.7in setup.py - Updated version to
5.0.1-betain setup.py, pyproject.toml, and configuration.py - Migrated all Pydantic model classes from v1
Configclass to v2model_configdictionary - Updated all
@validatordecorators to@field_validatorfor Pydantic v2 compatibility
Reviewed changes
Copilot reviewed 267 out of 268 changed files in this pull request and generated 228 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.py | Updated version to 5.0.1-beta and pydantic requirement to >= 2.11.7 |
| pyproject.toml | Updated version to 5.0.1-beta |
| configuration.py | Updated SDK version string to 4.5.1 |
| cashfree_pg/models/*.py | Migrated ~200+ model files from Pydantic v1 to v2 syntax |
| cashfree_pg/api_response.py | Added compatibility comment |
Comments suppressed due to low confidence (1)
pyproject.toml:17
- The pyproject.toml file still specifies pydantic v1 constraints (
^1.10.5, <2) which conflicts with the setup.py requirement of>= 2.11.7. This will cause dependency resolution failures. Update this to match the setup.py requirement:pydantic = \"^2.11.7\"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "Python Version: {pyversion}\n"\ | ||
| "Version of the API: 2023-08-01\n"\ | ||
| "SDK Package Version: 4.3.10".\ | ||
| "SDK Package Version: 4.5.1".\ |
There was a problem hiding this comment.
The SDK version in the debug report string is hardcoded to '4.5.1' but should be updated to '5.0.1-beta' to match the actual package version being released.
| @field_validator('channel') | ||
| def channel_validate_enum(cls, value): |
There was a problem hiding this comment.
Pydantic v2 field validators require the 'mode' parameter to be specified. The decorator should be @field_validator('channel', mode='before') or @field_validator('channel', mode='after') depending on when validation should occur. This applies to all field_validator usages across all model files.
|
|
||
| from typing import Optional | ||
| from pydantic import BaseModel, Field, StrictStr | ||
| from pydantic import field_validator |
There was a problem hiding this comment.
Import of 'field_validator' is not used.
| from pydantic import field_validator |
|
|
||
| from typing import Any, Dict, Optional, Union | ||
| from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr | ||
| from pydantic import field_validator |
There was a problem hiding this comment.
Import of 'field_validator' is not used.
| from pydantic import field_validator |
| from cashfree_pg.models.balance_details import BalanceDetails | ||
| from cashfree_pg.models.charges_details import ChargesDetails | ||
| from cashfree_pg.models.transfer_details import TransferDetails | ||
| from pydantic import field_validator |
There was a problem hiding this comment.
Import of 'field_validator' is not used.
| from pydantic import field_validator |
| from typing import List, Optional | ||
| from pydantic import BaseModel, conlist | ||
| from cashfree_pg.models.vendor_entity_related_docs_inner import VendorEntityRelatedDocsInner | ||
| from pydantic import field_validator |
There was a problem hiding this comment.
Import of 'field_validator' is not used.
| from cashfree_pg.models.bank_details import BankDetails | ||
| from cashfree_pg.models.schedule_option import ScheduleOption | ||
| from cashfree_pg.models.vendor_entity_related_docs_inner import VendorEntityRelatedDocsInner | ||
| from pydantic import field_validator |
There was a problem hiding this comment.
Import of 'field_validator' is not used.
|
|
||
| from typing import Optional | ||
| from pydantic import BaseModel, StrictStr | ||
| from pydantic import field_validator |
There was a problem hiding this comment.
Import of 'field_validator' is not used.
|
|
||
| from typing import Any, Dict, Optional, Union | ||
| from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr | ||
| from pydantic import field_validator |
There was a problem hiding this comment.
Import of 'field_validator' is not used.
|
|
||
| from typing import Optional | ||
| from pydantic import BaseModel, StrictStr | ||
| from pydantic import field_validator |
There was a problem hiding this comment.
Import of 'field_validator' is not used.
Raising PR to github